package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     int
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}
type QingNiuYun struct {
	Ak  string
	Sk  string
	Bk  string
	Url string
}
type AppConfig struct {
	Mysql      Mysql
	Redis      Redis
	QingNiuYun QingNiuYun
}

var Config AppConfig

func Init() {
	viper.SetConfigFile("../appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Config)
	fmt.Println("配置文件读取成功", Config)
}
